Skip to content

Use keys in dictionary if value for IN operator#301

Open
jeffdgr8 wants to merge 1 commit intoproject-imas:masterfrom
jeffdgr8:in-dictionary
Open

Use keys in dictionary if value for IN operator#301
jeffdgr8 wants to merge 1 commit intoproject-imas:masterfrom
jeffdgr8:in-dictionary

Conversation

@jeffdgr8
Copy link

@jeffdgr8 jeffdgr8 commented May 26, 2018

This is the way the default NSSQLiteStoreType behaves. Iterating over an NSDictionary iterates over its keys as well.

Currently, if a dictionary is used as the value for IN in a predicate, it creates SQL: SELECT ... FROM ... WHERE (... IN ?); and produces the error could not prepare statement: near "?": syntax error.

With these changes, the SQL is: SELECT ... FROM ... WHERE (... IN (?, ?, ...));, where the bindings for ?, ?, ... are the dictionary's keys.

This is the way the default NSSQLiteStoreType behaves. Iterating over an NSDictionary iterates over its keys as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant